package com.syezon.wifikey.redbag;


import android.arch.lifecycle.Observer;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.syezon.wifikey.base.BaseFragment;
import com.syezon.wifikey.R;
import com.syezon.wifikey.redbag.adapter.RedBagAdapter;
import com.syezon.wifikey.redbag.info.RedBagInfo;

import java.util.List;

import butterknife.BindView;

public class PacketFragment extends BaseFragment {

    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    private String mParam1;
    private String mParam2;

    @BindView(R.id.refresh_layout)
    SmartRefreshLayout mRefreshLayout;
    @BindView(R.id.rv_redbag)
    RecyclerView mRvRedBag;
    private RedBagAdapter mRedBagAdapter;

    public PacketFragment() {
    }

    public static PacketFragment newInstance() {
        PacketFragment fragment = new PacketFragment();
        return fragment;
    }

    public static PacketFragment newInstance(String param1, String param2) {
        PacketFragment fragment = new PacketFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }


    @Override
    protected View getLoadingTargetView() {
        return mRefreshLayout;
    }

    @Override
    protected void initViewsAndEvents() {
        mRvRedBag.setLayoutManager(new LinearLayoutManager(getContext()));
        mRedBagAdapter = new RedBagAdapter(getContext());
        mRvRedBag.setAdapter(mRedBagAdapter);
    }

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.fragment_packet;
    }
}
